package top.yueyazhui.storage.controller;

import io.seata.rm.tcc.api.BusinessActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import top.yueyazhui.common.feign.StorageFeign;
import top.yueyazhui.storage.service.StorageService;

@RestController
public class StorageController implements StorageFeign {

    @Autowired
    StorageService storageService;

    @Override
    public boolean prepare(BusinessActionContext businessActionContext, String commodityCode, Integer count) {
        return storageService.prepare(commodityCode, count);
    }

    @Override
    public boolean commit(BusinessActionContext businessActionContext) {
        return storageService.commit(businessActionContext);
    }

    @Override
    public boolean rollback(BusinessActionContext businessActionContext) {
        return storageService.rollback(businessActionContext);
    }
}
